import 'package:flutter/material.dart';
import 'package:widget_examples/buttons.dart';
import 'package:widget_examples/circle_avater.dart';
import 'package:widget_examples/dismissable.dart';
import 'package:widget_examples/focus_scope.dart';
import 'package:widget_examples/immersive.dart';
import 'package:widget_examples/input_field.dart';
import 'package:widget_examples/listview.dart';
import 'package:widget_examples/media_query.dart';
import 'package:widget_examples/overlay_style.dart';
import 'package:widget_examples/single_child_scroll_view.dart';
import 'package:widget_examples/text.dart';
import 'package:widget_examples/transfer.dart';

import 'hit_test_behavior.dart';

class Home extends StatelessWidget {
  const Home({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
          child: Center(
              child: SingleChildScrollView(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            RouterButton(title: 'dismissable', target: DismissableExps()),
            RouterButton(title: 'input field', target: InputFieldExps()),
            RouterButton(title: 'avatar', target: CircleAvatarExps()),
            RouterButton(title: 'button', target: ButtonExps()),
            RouterButton(title: 'transfer', target: Transfer()),
            RouterButton(title: 'system ui mode', target: SystemUIModeExps()),
            RouterButton(title: 'overlay style', target: OverlayStyleExps()),
            RouterButton(title: 'media query', target: MediaQueryExps()),
            RouterButton(title: 'focus scope', target: FocusScopeExps()),
            RouterButton(
                title: 'hit test behavior', target: HitTestBehaviorExps()),
            RouterButton(title: 'text', target: TextExps()),
            RouterButton(title: 'single child scroll view', target: MySingleChildScrollView()),
            RouterButton(title: 'list view', target: ListViewExps()),
          ],
        ),
      ))),
    );
  }
}

class RouterButton extends StatelessWidget {
  final String title;
  final Widget target;

  const RouterButton({super.key, required this.title, required this.target});

  @override
  Widget build(BuildContext context) {
    return ElevatedButton(
      onPressed: () {
        Navigator.push(
          context,
          MaterialPageRoute(builder: (context) => target),
        );
      },
      child: Text(title),
    );
  }
}
